<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.yaodian100.com/jsp/yaodian100" prefix="yaodian100" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page import="com.yaodian100.core.common.utils.ServerValue"%>
<%@page import="java.util.List"%>
<%@page import="org.apache.commons.lang.xwork.StringUtils"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<%@page import="com.yaodian100.ec.timelimitsale.entity.TimeLimitMain"%>

<%@page import="com.yaodian100.core.common.utils.DateUtil"%><c-rt:set var="midContextPath" value='<%=ServerValue.getMidContextPath() %>'/>
<!-- 月历 -->
<script type="text/javascript" charset="UTF-8" src="/js/jquery.datepick.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.datepick-zh-CN.js"></script>
<link rel="stylesheet" type="text/css" href="/css/smoothness.datepick.css" />
<script language="javascript">
$().ready( function() {
	$('#startDateParam').datepick({minDate: null, showOn:'both',numberOfMonths:2, buttonImageOnly: true, buttonImage: '/images/calendar.gif',dateFormat:"yy-mm-dd"}); 
	$('#endDateParam').datepick({minDate: null,beforeShow:customRange,showOn: 'both',numberOfMonths:2, buttonImageOnly: true, buttonImage: '/images/calendar.gif',dateFormat:"yy-mm-dd"});
	function customRange (){
		var startDt = $('#startDateParam').val(); //起始日
		var endDt = new Date(parseInt(startDt.substring(0,4),10),parseInt(startDt.substring(5,7),10)-1,parseInt(startDt.substring(8,10),10)); //結束日
		return {minDate:endDt}; 
	}
});
</script>
<br />
<h1>问卷管理<br/>
<div class="f-link"><a href="${midContextPath}/survey/add.do">新增</a></div>
</h1>
<div class="data-form"><s:form action="search.do" method="post">
	<b>问卷名称：</b>
	<input name="nameParam" type="text" id="nameParam"
		value="${nameParam}" size="20" maxlength="20">
	<b>起迄时间：</b>
	<input name="startDateParam" type="text" id="startDateParam"
		value="${startDateParam}" size="10" maxlength="10">
    ~ <input name="endDateParam" type="text" id="endDateParam"
		value="${endDateParam}" size="10" maxlength="10">
	<input type="button" value="搜寻" onClick="this.form.submit();" />
</s:form></div>
<br />
<table class="tb-1"  width="100%">
	<thead>
		<tr>
			<th>#</th>
			<th>起迄日期</th>
			<th>问卷名称</th>
			<th>管理</th>
		</tr>
	</thead>
	<tbody>
		<c-rt:forEach items="${surveyList}" var="survey" varStatus="index">
			<tr>
				<td>${index.count}</td>
				<td>
					<fmt-rt:formatDate value="${survey.startDate}" pattern="yyyy-MM-dd"/>~
					<fmt-rt:formatDate value="${survey.endDate}" pattern="yyyy-MM-dd"/>
				</td>
				<td>${survey.name}</td>
				<td>
					<a href="${midContextPath}/survey/edit.do?id=${survey.id}">修改內容</a>
				</td>
			</tr>
		</c-rt:forEach>
	</tbody>
</table>
<yaodian100:pageutil link="${midContextPath}/survey/search.do" pagerObj="${pager}" />